<?php
if ($forums) {
  $group_id = 0;
  foreach($forums as $row) {
    if ($group_id != $row['group_id']) {
      if ($group_id != 0) {
        echo '</tbody>';
        echo '</table>';
      }
      echo '<table class="fw fb">';
      echo '<thead>';
      echo '<tr>';
      echo '<th colspan="2">'.$row['group_name'].'</th>';
      echo '</tr>';
      echo '</thead>';
      echo '<tbody>';
      $group_id = $row['group_id'];
    }
    echo '<tr>';
    echo '<td class="ico">[ICO]</td>';
    echo '<td class="title">'.anchor('forum/'.$row['category_id'].'/'.$row['category_slug'], $row['category_name']).'</td>';
    echo '</tr>';
  }
  echo '</tbody>';
  echo '</table>';
} else {
  echo '<p class="notice">'.lang('No forums found').'</p>';
}
?>